package ar.com.ctrln.persistence.dao.contacto;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import ar.com.ctrln.persistence.dao.AbstractHibernateDao;
import ar.com.ctrln.persistence.model.contacto.Contacto;

@Repository("contactoDao")
public class HibernateContactoDao extends AbstractHibernateDao<Contacto>
		implements ContactoDao {

	@Override
	@Transactional(readOnly = true)
	public Contacto getContactoDocumento(String doc) {

		Query q = getSession().createQuery(
				"from Contacto as c where c.documento = ?");

		q.setParameter(0, doc);

		return (Contacto) q.uniqueResult();
	}

}
